<template>
    <view class="content">
        <view class="title">{{ title }}</view>
        <view class="art-content">
            <rich-text class="richText" :nodes="strings"></rich-text>
        </view>
    </view>
</template>

<script>
export default {
    data() {
        return {
            title: '',
            strings: ''
        };
    },
    onLoad: function(e) {
        uni.request({
            url: 'https://unidemo.dcloud.net.cn/api/news/36kr/' + e.newsid,
            method: 'GET',
            success: res => {
                this.title = res.data.title;
                this.strings = res.data.content;
            },
            fail: () => {
                uni.showToast({
                    title: '加载失败，请重试',
                    icon: 'none'
                });
            }
        });
    }
}
</script>

<style>
.content {
    padding: 20px; 
    width: calc(100% - 40px); 
    margin: auto; 
    background-color: #e4ffff; 
    border-radius: 8px; 
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex; 
    flex-direction: column; 
    align-items: center; 
}

.title {
    line-height: 1.5em;
    font-weight: 700;
    font-size: 28px; 
    color: #333; 
    margin-bottom: 15px; 
    text-align: center; 
    width: 97%; 
    max-width: 600px; 
    border: 2px solid #f0f0f0; 
    padding: 10px; 
    border-radius: 8px; 
    background-color: white; 
}

.art-content {
    line-height: 1.8em;
    font-size: 16px; 
    color: #555; 
    background-color: white; 
    padding: 15px; 
    border-radius: 8px; 
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1); 
    width: 95%; 
    max-width: 600px; 
}

/* 响应式设计 */
@media (max-width: 600px) {
    .title {
        font-size: 24px; /* 小屏幕上的标题大小 */
    }

    .art-content {
        font-size: 14px; /* 小屏幕上的内容大小 */
    }
}
</style>